Validate that tests don't leaks tracers, scopes and pooled objects#1275
Merged
felixbarny merged 2 commits intoelastic:masterfrom Jul 23, 2020
Merged
Validate that tests don't leaks tracers, scopes and pooled objects#1275felixbarny merged 2 commits intoelastic:masterfrom
felixbarny merged 2 commits intoelastic:masterfrom
Conversation
47639c3 to
881bb14
Compare
eyalkoren
approved these changes
Jul 8, 2020
apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Destination.java
Show resolved
Hide resolved
eyalkoren
reviewed
Jul 8, 2020
...plugin/src/test/java/co/elastic/apm/agent/spring/scheduled/TimerTaskInstrumentationTest.java
Outdated
Show resolved
Hide resolved
881bb14 to
8968f9b
Compare
Validate recycling and scope leaks after each test method Fixes scope leak in Executor#submitAll instrumentation
8968f9b to
5842ad6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Depends on #1271
With #1270 we have a good foundation to make sure tracers don't leak to other tests classes. This makes
GlobalTracermore restrictive so that a tracer can only be set viainitthat throws if the current tracer is not a noop.I have also added the recycling tests on the
@AfterEachmethod ofAbstractInstrumentationTestwhich required some adjustments to tests to make sure all transactions and spans are ended and thus recycled after being reported. It also checks the bookkeeper object pool to make sure all objects have returned. This also implicitly tests for scope leaks as those would prevent objects from being recycled.As a bonus, I've found and fixed a scope leak in the currently unreleased instrumentation of
Executor#executeAll.Checklist
I have updated CHANGELOG.asciidoc